﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.model.Instance;
using l1cs.server.model;

namespace l1cs.server.serverpackets
{
    public class S_NPCTalkActionTPUrl : ServerBasePacket
    {
        private byte[] _byte = null;

        public S_NPCTalkActionTPUrl( L1NpcTalkData cha, Object[] prices, int objid )
        {
            buildPacket( cha, prices, objid );
        }

        private void buildPacket( L1NpcTalkData npc, Object[] prices, int objid )
        {
            String htmlid = "";
            htmlid = npc.getTeleportURL();
            writeC( Opcodes.S_OPCODE_SHOWHTML );
            writeD( objid );
            writeS( htmlid );
            writeH( 0x01 ); // 不明
            writeH( prices.Length ); // 引数の数

            foreach ( Object price in prices )
            {
                writeS( Convert.ToString( ( Convert.ToInt32( price ) ) ) );
            }
        }

        override
        public byte[] getContent()
        {
            if ( _byte == null )
            {
                _byte = _bao.ToArray();
            }
            return _byte;
        }

        override
        public String getType()
        {
            return "[S] S_NPCTalkActionTPUrl";
        }
    }
}